﻿function confirmPassword(handler) {
	var label = new Ext.form.Label({
				text : '您所要进行的操作需要您的密码进行确认'
			});
	var password = new Ext.form.TextField({
				fieldLabel : '密码',
				anchor : '98%',
				minLength : 5,
				maxLength : 20,
				allowBlank : false,
				inputType : 'password',
				enableKeyEvents : true
			});
	password.on('keypress', function(t, e) {
				if (e.getKey() == e.ENTER) {
					btnok.focus();
					onok();
				}
			});
	var btnok = new Ext.Button({
				text : '确定',
				iconCls : 'ok-icon',
				handler : onok
			});
	var form = new Ext.FormPanel({
				frame : true,
				labelAlign : 'right',
				labelWidth : 50,
				items : [{
							bodyStyle : 'text-align:center;padding-bottom:10px;padding-top:5px',
							items : label
						}, password],
				fbar : [new Ext.Button({
									text : '取消',
									iconCls : 'cancel-icon',
									handler : function() {
										win.close();
									}
								}), btnok]
			});
	var win = new Ext.Window({
				width : 300,
				autoHeight : true,
				title : '密码确认',
				iconCls : 'password-icon',
				items : form
			});
	win.show();
	password.focus(true, 200);

	function onok() {
		if (!form.getForm().isValid()) {
			alertx('请正确密码！');
			return;
		}
		handler(password.getValue());
		win.close();
	}
}